<?php
$db = new Database();
if(isset($_POST['action'])){
    if($_POST['action']=="addinfoTag"||$_POST['action']=="editinfoTag"){
        $imageID = $_POST['imageID']; // Image ID
        $tagID = $_POST['tagID']; // Tagged ID
        $editTag = $db->query("SELECT * FROM tag WHERE id='$tagID'","row");
        //$cabinetName = $_POST['cabinetName'];
    ?>
    <div class="information">
    <div class="titleBar">
        <div class="holderLeft">
           <div class="titlePosition">
           Information
           </div>
        </div>
        <div class="holderRight align_right">
           <!--input type="button" name="backTop" id="backTop" class="button" value="Save" /-->
           
        </div>
     </div>
     <div class="Holdercontent">
        <div class="top">
           <div class="textfieldPosition">
              <div class="title align_left">Basic Information</div>
              <form class="taggingInfo">
                 
              <div class="fields">
                 <div class="label_1">Port #:</div>
                 <div class="input"><input type="text" name="portnumber" id="portnumber" class="textfield_one" value="<?php echo $editTag['portNumber'];?>"/></div>
              </div>
              <!--div class="fields">
                 <div class="label_1">Cabinet:</div>
                 <div class="input"><input type="text" name="cabinet" id="cabinet" class="textfield_one"  value="<?php echo $cabinetName;?>"/></div>
              </div-->
              <div class="fields">
                 <div class="label_1">Status:</div>
                 <div class="input">
                    <select name="statusBlink" id="" class="selection1 statusBlink">
                       <option class="defaulSelected" id="greenStat" value="greenStat" <?php if($editTag['statusBlink']=="greenStat"){echo "selected=selected";}?>>Green</option>
                       <option id="redStat" value="redStat"  <?php if($editTag['statusBlink']=="redStat"){echo "selected=selected";}?>>Red</option>
                    </select>
                 </div>
              </div>
           </div>
           
        </div>
        <div class="hr"></div>
        <div class="down">
           <div class="textfieldPosition">
              <div class="title align_left">Data Terminal</div>
              <div class="fields">
                 <div class="label_1">Computer Name:</div>
                 <div class="input"><input type="text" name="workstationType" id="workstationType" class="textfield_one" value="<?php echo $editTag['workstation'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">Description:</div>
                 <div class="input"><input type="text" name="description" id="description" class="textfield_one" value="<?php echo $editTag['description'];?>" /></div>
              </div>
              <div class="fields">
                 <div class="label_1">IP Address:</div>
                 <div class="input"><input type="text" name="IPAddress" id="IPAddress" class="textfield_one"  value="<?php echo $editTag['ipAddress'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">MAC:</div>
                 <div class="input"><input type="text" name="mac" id="mac" class="textfield_one"  value="<?php echo $editTag['mac'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">VLan #:</div>
                 <div class="input"><input type="text" name="vLan" id="vLan" class="textfield_one" value="<?php echo $editTag['vLan'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">Extra Fields:</div>
                 <div class="input"><input type="text" name="etf1" id="etf1" class="textfield_one" value="<?php echo $editTag['etf1'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">Extra Fields:</div>
                 <div class="input"><input type="text" name="etf2" id="etf2" class="textfield_one" value="<?php echo $editTag['etf2'];?>"/></div>
              </div>
           </div>
        </div>
        <div class="hr"></div>
        <div class="down">
           <div class="textfieldPosition">
              <div class="title align_left">Telephone Terminals</div>
              
              <div class="fields">
                 <div class="label_1">Directory Name:</div>
                 <div class="input"><input type="text" name="directoryName" id="directoryName" class="textfield_one"  value="<?php echo $editTag['directoryName'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">Local Number:</div>
                 <div class="input"><input type="text" name="localNumber" id="localNumber" class="textfield_one"  value="<?php echo $editTag['localNumber'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">Station Type:</div>
                 <div class="input">
                    <select name="StationType" id="" class="StationType selection1"  value="<?php echo $editTag['vLan'];?>">
                       <option class="defaulSelected" id="analog" value="analog" <?php if($editTag['stationType']=="analog"){echo "selected=selected"; }?>>Analog</option>
                       <option id="digital" value="digital" <?php if($editTag['stationType']=="digital"){echo "selected=selected"; }?>>Digital</option>
                       <option id="ipPhone" value="ipPhone" <?php if($editTag['stationType']=="ipPhone"){echo "selected=selected"; }?>>IP Phone</option>
                    </select>
                 </div>
              </div>
              <div class="fields">
                 <div class="label_1">IP Address:</div>
                 <div class="input"><input type="text" name="ttIPAddress" id="ttIPAddress" class="textfield_one"   value="<?php echo $editTag['ttipAddress'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">Equip. Add. PBX:</div>
                 <div class="input"><input type="text" name="EAPBX" id="EAPBX" class="textfield_one"   value="<?php echo $editTag['eaPBX'];?>"/></div>
              </div>
              <div class="fields">
                 <div class="label_1">Public Network Category:</div>
                 <div class="input">
                    <select name="COS" id="" class="selection1 COS">
                       <option class="defaulSelected" id="operator" value="IDD/NDD" <?php if($editTag['classService']=="IDD/NDD"){echo "selected=selected"; }?>>IDD/NDD</option>
                       <option id="user" value="NDD" <?php if($editTag['classService']=="NDD"){echo "selected=selected"; }?>>NDD</option>
                       <option id="user" value="City Calls" <?php if($editTag['classService']=="City Calls"){echo "selected=selected"; }?>>City Calls</option>
                    </select>
                 </div>
              </div>
              <div class="fields" style="border-bottom: none;">
                 <div class="label_1"></div>
                    <div class="input">
                       <div style="margin-top: 8px;">
                        <?php
                        if($_POST['action']=="addinfoTag"){
                        ?>
                            <input type="button" name="backTop" title="Save tagged information." data-image-id="<?php echo $imageID; ?>" id="backTop" class="saveTag cursor btn" value="Save" />
                        <?php
                        }else{
                        ?>
                            <input type="button" name="backTop" title="Update tagged information." data-tag-id="<?php echo $tagID; ?>" data-image-id="<?php echo $editTag['fileID']; ?>" id="backTop" class="updateTag cursor btn" value="Update" />
                        <?php
                        }
                        ?>
                       </div>
                    </div>
                 </div>
              </form>
              <br />
           </div>
        </div>
     </div>
     </div>
    <?php
    }
}